﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CutAways.Modeling;

namespace CutAways
{
	partial class PickObjectForm : Form
	{
		public event EventHandler Pick;

		public GeometricObject PickedObject
		{
			get { return listBoxObjects.SelectedItem as GeometricObject; }
		}

		public PickObjectForm(Model model)
		{
			InitializeComponent();
			initListBox(model);
		}

		private void initListBox(Model model)
		{
			foreach (GeometricObject o in model.Objects)
				listBoxObjects.Items.Add(o);
		}

		private void listBoxObjects_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (Pick != null)
				Pick(this, EventArgs.Empty);
		}
	}
}
